package com.dpteam.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * User: luolei
 * Date: 2016/1/11
 * Time: 8:46
 */
@Component
//@Aspect
public class LogAop {

    /**
     * 拦截controller的方法，before
     * @param jp
     */
    @Before("execution(* com.dpteam.controller.*.*(..))")
    public void controllerBefore(JoinPoint jp) {
        System.out.println("before controller method");
    }

    /**
     *
     * @param jp
     */
    @After("execution(* com.dpteam.controller.*.*(..))")
    public void controllerAfter(JoinPoint jp) {
        System.out.println("after controller method");
    }

    public Object around(ProceedingJoinPoint jp) {
        Object result = null;

        return result;
    }
}
